#include <iostream>
#include <vector>

using namespace std;

double addit(double, double); //加法
double subst(double, double); //减法
double mulit(double, double); //乘法
double divis(double, double); //除法

int main()
{
    vector<double>num(2);
    char ch;
    char err = 0;
    double res;
    cout << "请输入一个算式(加号：+ 减号：- 乘号：* 除号：/ 例如：1+1):";            
    cin >> num[0] >> ch >> num[1];
    
    switch (ch)
    {
        case '+':res = addit(num[0], num[1]);
        case '-':res = subst(num[0], num[1]);
        case '*':res = mulit(num[0], num[1]);
        case '/':res = divis(num[0], num[1]);
        defualt:cout << "请不要输入其他的运算符号！" << endl;err = 1;
    }

    if(err != 1 )
    {
        cout << num[0] << ch << num[1] << "=" << res << endl;
    }

    cout << "按回车键继续......";
    cin.get();

    return 0;
}

double addit(double num1, double num2)
{
    return num1 + num2;
}
double subst(double num1, double num2)
{
    return num1 - num2;
}
double mulit(double num1, double num2)
{
    return num1 * num2;
}
double divis(double num1, double num2)
{
    return num1 / num2;
}
